package br.com.brasileirao.teste;

import java.util.Date;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import br.com.brasileirao.modelo.Apac;
import br.com.brasileirao.modelo.Sexo;


public class TesteIncluirApac {
	
	public static void main(String[] args) {
		
		AnnotationConfiguration configuration = new AnnotationConfiguration();
		configuration.configure("/hibernate.cfg.xml");
		SessionFactory sessionFactory = configuration.buildSessionFactory();
		Session session = sessionFactory.openSession();
		session.beginTransaction();
		
		Apac apac = new Apac();
		apac.setCodigo("14527/9");
		apac.setNomeMae("segundo teste");
		apac.setCpfSolicitante("10824746721");
		apac.setCep("28970000");
		apac.setBairro("Areal");
		apac.setNome("Luiz de azevedo");
		apac.setDataAutorizacao(new Date());
		apac.setCompetencia("112009");
		apac.setCnsPaciente("14575");
		apac.setSexoPaciente(Sexo.M);
		
		
		session.save(apac);
		session.getTransaction().commit();
		
		
	}
	
	

}
